<template>
	<view class="page">
		<!-- 标题栏 start -->
		<fu-custom bgColor="bg-white" :isBack="true"><block slot="content">{{i18n['积分规则']}}</block></fu-custom>
		<!-- 标题栏 end -->
			<!-- 页面loading start -->
		<fu-loading v-if="isShowLoading"></fu-loading>
		<!-- 页面loading end -->
		<!-- 积分内容 start -->
		<view class="padding" v-else>
			<!-- <view v-html="text"></view> -->
			<jyf-parser :html="text"></jyf-parser>
		</view>
		<!-- 积分内容 end -->
	</view>
</template>
<script>
import richText from '@/common/utils/richText.js';
export default {
	data() {
		return {
			isShowLoading: false, //是否显示加载loading
			text: '' //规则内容
		};
	},
	/**
	 * 获取规则内容数据
	 */
	created() {
		this.getData();
	},
	methods: {
		/**
		 * @description 获取规则数据
		 */
		getData() {
			this.isShowLoading = true;
			this.$api
				.post(global.apiUrls.postIntegralRule)
				.then(res => {
					this.isShowLoading = false;
					console.log('积分规则', res.data);
					if (res.data.code == 1) {
						this.text = richText.format(res.data.data.content);
					} else {
						this.$message.info(res.data.msg);
					}
				})
				.catch(err => {
					this.isShowLoading = false;
					console.log('err: ' + JSON.stringify(err));
				});
		}
	}
};
</script>

<style lang="scss" scoped>
page {
	height: 100%;
}

// 规则内容 start
.page {
	max-width: 100%;
	overflow-x: hidden;
	min-height: 100%;
	background-color: #ffffff;
}
image {
	width: 100%;
}
// 规则内容 end
</style>
